package com.example.demo.service.impl;

import com.example.demo.dao.VdeRepository;
import com.example.demo.entity.Vde;
import com.example.demo.service.VdeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class VdeServiceImpl implements VdeService {
    @Autowired
    private VdeRepository vdeRepository;
    @Override
    public Vde add(Vde vde) throws Exception {
        return vdeRepository.save(vde);
    }

    @Override
    public List<Vde> list() throws Exception {
        return vdeRepository.findAll();
    }

    @Override
    public Vde get() throws Exception {

        List<Vde> list = vdeRepository.findAll();
        return  list.get(list.size()-1);
    }
}
